package toWeka;


import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Minute {
	private String date;
	private String time;
	private String Global_active_power; 
	
	private String Global_reactive_power;
	private String Voltage;
	private String Global_intensity;
	private String Sub_metering_1;
	private String Sub_metering_2;
	private String Sub_metering_3;
	
	
	

	
	
	public Minute(String date, String time, String global_active_power,
			String global_reactive_power, String voltage,
			String global_intensity, String sub_metering_1,
			String sub_metering_2,String sub_metering_3) {
		this.date = date;
		this.time = time;
		this.Global_active_power = global_active_power;
		this.Global_reactive_power = global_reactive_power;
		this.Voltage = voltage;
		this.Global_intensity = global_intensity;
		this.Sub_metering_1 = sub_metering_1;
		this.Sub_metering_2 = sub_metering_2;
		this.Sub_metering_3 = sub_metering_2;
	}
	
	
	public String getGlobal_active_power() {
		return Global_active_power;
	}

	public void setGlobal_active_power(String global_active_power) {
		Global_active_power = global_active_power;
	}

	public String getGlobal_reactive_power() {
		return Global_reactive_power;
	}

	public void setGlobal_reactive_power(String global_reactive_power) {
		Global_reactive_power = global_reactive_power;
	}

	public String getVoltage() {
		return Voltage;
	}

	public void setVoltage(String voltage) {
		Voltage = voltage;
	}

	public String getGlobal_intensity() {
		return Global_intensity;
	}

	public void setGlobal_intensity(String global_intensity) {
		Global_intensity = global_intensity;
	}

	public String getSub_metering_1() {
		return Sub_metering_1;
	}

	public void setSub_metering_1(String sub_metering_1) {
		Sub_metering_1 = sub_metering_1;
	}

	public String getSub_metering_2() {
		return Sub_metering_2;
	}

	public void setSub_metering_2(String sub_metering_2) {
		Sub_metering_2 = sub_metering_2;
	}

	public String getSub_metering_3() {
		return Sub_metering_3;
	}

	public void setSub_metering_3(String sub_metering_3) {
		Sub_metering_3 = sub_metering_3;
	}
	
	public String getFecha(){
		return this.date;
	}
	
	
	public Date getTime (){
		Date date = null;
	    DateFormat df = new SimpleDateFormat("HH:mm");
	    try{
	    	date = df.parse(this.time);
	    	System.out.println(date);
	    }
	    catch ( Exception ex ){
	        System.out.println(ex);
	    }
	    return date;
	}
	public Date getDate (){
		Date date = null;
	    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
	    try{
	    	date = df.parse(this.date);
	    	System.out.println(date);
	    }
	    catch ( Exception ex ){
	        System.out.println(ex);
	    }
	    return date;	
	}
	public Date getFullDate (){
		Date date = null;
	    DateFormat df = new SimpleDateFormat("dd/MM/yyyy-HH:mm");
	    try{
	    	date = df.parse(this.date+"-"+this.time);
	    	System.out.println(date);
	    }
	    catch ( Exception ex ){
	        System.out.println(ex);
	    }
	    return date;	
	}
	@Override 
	public String toString (){
		return this.time+"|"+this.date+"|"+this.Global_active_power; 
	}
	
}
